<?php
// =====================================================
// AnthroHeart - Master Final Page
// - Real-Time Linux Kernel Network Measurement
// - High-Integrity Unique IP Counter (SHA256)
// - Cinematic Cinematic Styling & SEO Suite
// =====================================================

// 1. CACHE BUSTING (Ensures real-time stats for the 64+ visitors)
header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0");
header("Pragma: no-cache");
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");

// 2. HIGH-INTEGRITY COUNTER LOGIC
$counter_file = __DIR__ . '/visitors.txt';
$unique_file  = __DIR__ . '/unique_visitors.txt';

if (!file_exists($counter_file)) { file_put_contents($counter_file, "1", LOCK_EX); }
if (!file_exists($unique_file)) { file_put_contents($unique_file, serialize([]), LOCK_EX); }

$count_raw = @file_get_contents($counter_file);
$count = is_string($count_raw) ? (int)trim($count_raw) : 1;

$ip = $_SERVER['REMOTE_ADDR'] ?? 'unknown';
$date = date('Y-m-d');
$visitor_key = hash('sha256', $ip . '|' . $date);

$unique_raw = @file_get_contents($unique_file);
$unique_visitors = @unserialize($unique_raw);
if (!is_array($unique_visitors)) { $unique_visitors = []; }

if (!in_array($visitor_key, $unique_visitors, true)) {
    $unique_visitors[] = $visitor_key;
    $count++;
    file_put_contents($counter_file, (string)$count, LOCK_EX);
    file_put_contents($unique_file, serialize($unique_visitors), LOCK_EX);
}

// 3. ROBUST REAL-TIME NETWORK MONITOR (Finds active IONOS interface automatically)
function get_node_speed() {
    $file = __DIR__ . '/speed.txt';
    if (file_exists($file)) {
        return trim(file_get_contents($file));
    }
    return "0.00";
}

$live_speed = get_node_speed();

// 4. SEO CONFIGURATION
$site_url = "https://anthroheart.com";
$preview_img = $site_url . "/blueheart.png";
?>
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <title>AnthroHeart Universe – A Public Domain Mythos</title>
  
  <!-- SEO & Social Previews (Telegram/Twitter/FB) -->
  <meta name="description" content="147 songs · 23 characters · 100% Public Domain. High-velocity Bitcoin notarized archive.">
  <meta property="og:title" content="AnthroHeart Universe – Public Domain Studio-in-a-Box">
  <meta property="og:description" content="Mythic. Musical. Free forever. Seeding at 1.5Gbps.">
  <meta property="og:image" content="<?= $preview_img ?>">
  <meta property="og:url" content="<?= $site_url ?>/">
  <meta name="twitter:card" content="summary_large_image">
  <meta name="twitter:image" content="<?= $preview_img ?>">

  <link href="https://fonts.googleapis.com/css2?family=Cinzel:wght@700&family=Montserrat:wght@400;600&family=Fira+Code&display=swap" rel="stylesheet">
  
  <style>
    :root {
      --gold: #d4af37;
      --bg-dark: #0f0a05;
      --text-color: #ffebcd;
      --terminal-green: #00ff00;
      --alert-blue: #00f2ff;
    }

    body { margin:0; font-family:'Montserrat', sans-serif; background: var(--bg-dark); color: var(--text-color); line-height: 1.6; overflow-x: hidden; }
    .container { max-width: 1000px; margin: 0 auto; padding: 0 20px; }
    section { padding: 60px 0; border-bottom: 1px solid rgba(212,175,55,0.1); }
    h1, h2, h3 { font-family: 'Cinzel', serif; text-align: center; color: var(--gold); text-shadow: 0 0 15px rgba(212,175,55,0.4); }
    
    /* --- Hero Section --- */
    .marquee-hero { position: relative; width: 100%; height: 75vh; min-height: 500px; background: #000; border-bottom: 5px solid var(--gold); overflow:hidden; }
    .marquee-frame { position: absolute; inset: 0; z-index: 3; pointer-events: none; border: 15px solid var(--gold); box-shadow: 0 0 30px rgba(255,215,0,0.5), inset 0 0 20px rgba(0,0,0,0.8); }
    .hero-content { position:absolute; bottom: 10%; width: 100%; text-align:center; z-index:4; }

    /* --- Stats Dashboard (Real Time) --- */
    .stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 15px; margin: 20px 0; }
    .stat-item { background: rgba(0, 255, 0, 0.05); border: 1px dashed var(--terminal-green); padding: 15px; font-size: 0.9em; border-radius: 4px; }
    .live-pulse { color: var(--terminal-green); font-family: 'Fira Code', monospace; font-weight: bold; font-size: 1.2em; }

    /* --- Access Nodes --- */
    .node-grid { display: flex; flex-wrap: wrap; justify-content: center; gap: 20px; margin: 40px 0; }
    .node-card { background: linear-gradient(180deg, #1a0f06, #2b1b0a); border: 2px solid var(--gold); border-radius: 12px; padding: 25px; text-align: center; text-decoration: none; color: var(--text-color); transition: 0.3s; flex: 1 1 300px; }
    .node-card:hover { transform: translateY(-5px); box-shadow: 0 0 30px var(--gold); }

    /* --- Utility --- */
    img { max-width: 100%; height: auto; border-radius: 8px; }
    .terminal { background: #001a00; border: 2px solid var(--terminal-green); border-radius: 10px; padding: 20px; font-family: 'Fira Code', monospace; color: var(--terminal-green); box-shadow: 0 0 20px rgba(0,255,0,0.2); }
    .btn-gold { display: inline-block; padding: 15px 40px; background: linear-gradient(45deg, #b8860b, #ffd700); color: #2b1b0a; font-weight: bold; text-decoration: none; border-radius: 50px; text-transform: uppercase; letter-spacing: 1px; transition: 0.3s; border:none; cursor:pointer; }
    .btn-gold:hover { transform: scale(1.05); box-shadow: 0 0 25px var(--gold); }
    .notice-box { background: rgba(255, 235, 205, 0.05); border-left: 5px solid var(--gold); padding: 30px; border-radius: 0 12px 12px 0; margin: 40px 0; }

    footer { background: #000; padding: 60px 20px; text-align: center; border-top: 5px solid var(--gold); }
    .stats-badge { font-size: 3.5rem; color: var(--terminal-green); text-shadow: 0 0 15px var(--terminal-green); display: block; margin: 10px 0; font-family: 'Fira Code', monospace; }
  </style>
</head>
<body>

  <div class="marquee-hero">
    <div class="marquee-frame"></div>
    <iframe
        src="https://www.youtube.com/embed/l93bUo1imXE?autoplay=1&mute=1&loop=1&playlist=l93bUo1imXE&controls=0&modestbranding=1"
        style="position:absolute; top:0; left:0; width:100%; height:100%; border:none;"
        allow="autoplay; encrypted-media">
    </iframe>
    <div class="hero-content">
        <h1 style="font-size: clamp(2rem, 8vw, 4rem); margin:0;">ANTHROHEART UNIVERSE</h1>
        <p style="font-size: 1.2rem; background: rgba(0,0,0,0.7); display:inline-block; padding: 10px 30px; border-radius: 50px; border: 1px solid var(--gold);">A Gift to Humanity from Thomas B Sweet</p>
    </div>
  </div>

  <div class="container">

<!-- REAL-TIME INFRASTRUCTURE -->
    <section>
      <h2>🛰️ SATELLITE STATUS</h2>
      <p style="text-align:center;">Telemetry streamed from origin node. Kernel statistics updated via real-time background monitor.</p>
      <div class="stats-grid">
        <div class="stat-item">
          🚀 <strong>Seeding Velocity:</strong> <br>
          <span class="live-pulse"><?php echo $live_speed; ?> Mbps</span>
        </div>
        <div class="stat-item">
          📉 <strong>Verified Burst:</strong> <br>
          <span class="live-pulse">1,867 Mbps</span>
        </div>
        <div class="stat-item">
          🧠 <strong>Logic:</strong> <br>
          <span class="live-pulse">BBR-Optimized</span>
        </div>
        <div class="stat-item">
          ⛓️ <strong>Blockchain:</strong> <br>
          <span class="live-pulse">Block 929481</span>
        </div>
      </div>
    </section>

    <section>
      <h2>The Purpose</h2>
      <div class="notice-box">
        <p style="font-size: 1.2rem;"><strong>AnthroHeart Universe is a complete “Studio-in-a-Box” creative franchise released fully into the Public Domain.</strong></p>
        <p>147 songs, 23 characters, and a massive trilogy of lore. Released openly so the soul of this universe can live in the hands of the people forever.</p>
        <p><em>"He never forgets that I was the one who made it safe to stop being God and start being held."</em></p>
      </div>
    </section>

    <section>
      <h2>✦ THE ACCESS NODES ✦</h2>
      <div class="node-grid">
        <a href="<?= $site_url ?>/index.php" class="node-card">
          <div style="font-size: 3rem;">📦</div>
          <h3>Genesis Bundle</h3>
          <p>Download the 5.33GB Full Archive <br>(7z, Torrent, JSON Proofs)</p>
        </a>
        <a href="http://archive.anthroentertainment.com" target="_blank" class="node-card">
          <div style="font-size: 3rem;">🏛️</div>
          <h3>Internet Archive</h3>
          <p>Permanent Mirror & <br>Browser Preview</p>
        </a>
      </div>
      <div style="text-align:center;">
        <a href="https://anthroentertainmentllc.itch.io/" target="_blank" class="btn-gold">Explore on itch.io</a>
      </div>
    </section>

    <!-- TRADITIONAL ART -->
    <section>
      <h2>Memories in My Pencil</h2>
      <div style="text-align:center; margin-bottom: 40px;">
        <img src="images/SherryDrawing.jpg" alt="Sherry Pencil Drawing" style="max-width: 500px; border: 4px solid var(--gold); box-shadow: 0 0 40px rgba(212,175,55,0.5);">
        <p style="margin-top:20px; font-style: italic; color: var(--gold); font-size: 1.2rem;">Sherry: "Kiss my rose." — Graphite on paper.</p>
      </div>
      <p>Every character in this bundle started with a real human connection. This archive is a tribute to the teachers, coworkers, and friends who crossed my path. I stayed home and built this 10GB universe to ensure that these memories and these frequencies belong to the world, not a corporation.</p>
    </section>

    <!-- GENESIS CODE -->
    <section>
      <h2>The Beast of '88</h2>
      <div style="text-align:center;">
        <img src="images/computer.jpg" alt="VTech PreComputer 1000" style="max-width: 600px; border: 4px solid #4169e1; filter: sepia(0.3);">
        <p style="color: #87cefa; margin-top:15px;">VTech PreComputer 1000. Where the logic began.</p>
      </div>
      <div class="terminal" style="margin-top:30px;">
        <p>> 10 PRINT "How many French fries did you eat?"<br>
        > 20 INPUT F<br>
        > 30 PRINT "How many inches was each French fry?"<br>
        > 40 INPUT I<br>
        > 50 PRINT "You just ate a "; F*I;" inch French fry."<br>
        > 60 END</p>
      </div>
      <p style="text-align:center; margin-top:20px; opacity: 0.8;">Peak comedy achieved at age 7. Digital sovereignty achieved today.</p>
    </section>

    <!-- LEGAL -->
    <section>
      <h2>Sovereign Rights</h2>
      <div class="notice-box" style="border-color: var(--alert-blue);">
        <h3>CC0 Public Domain</h3>
        <p>I hereby release all intellectual property of the AnthroHeart Universe into the public domain. Use it, remix it, sell it, love it. No permission or attribution required.</p>
        <p><strong>Proof of Existence:</strong> Anchored to Bitcoin Block 929481 via OpenTimestamps.</p>
      </div>
    </section>

    <!-- DONATION -->
    <section>
      <div style="text-align:center; padding: 50px; background: rgba(20,15,5,0.8); border: 2px solid var(--gold); border-radius: 20px; box-shadow: 0 0 50px rgba(212,175,55,0.2);">
        <h3>🐾 Support the Legacy</h3>
        <p style="max-width: 600px; margin: 10px auto 30px;">I built this on disability and said no to 126% interest loans. If you value this gift, help me establish the business checking account for Anthro Entertainment LLC.</p>
        <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=healing@intentionrepeater.com&currency_code=USD" class="btn-gold">Send Love via PayPal</a>
      </div>
    </section>

    <!-- METLIFE TRIBUTE -->
    <section>
        <div style="background: #fff; color: #333; padding: 30px; border-radius: 12px; border-left: 10px solid #0071c5;">
            <h2 style="color: #0071c5; text-align:left; text-shadow:none; margin-top:0;">Thank You, MetLife</h2>
            <p>"Get Met. It Pays." — It truly does. MetLife delivered on their promise during my most challenging chapter. I am grateful for their role in this launch.</p>
            <p style="text-align:right; font-style:italic; margin:0;">– Anthro Entertainment LLC</p>
        </div>
    </section>

  </div>

  <footer>
    <div class="container">
      <div class="terminal" style="display:inline-block; padding: 10px 40px; margin-bottom: 20px;">
        <span class="stats-badge"><?php echo number_format($count); ?></span>
        Unique souls have discovered the Heart.
      </div>
      <p>© 2025 Thomas B Sweet · Public Domain · Anchored to the Ledger of Truth</p>
      <p style="opacity: 0.4; font-size: 0.8rem;">High-Velocity Seeding Node: 69.48.205.55 (Debian 12)</p>
    </div>
  </footer>

</body>
</html>